<template>
	<view class="fault-pages">
		<view class="bg-img"></view>
		<view class="info-block">
			<view class="user-block" :style="'padding-top:'+mt">
				<image :src="info.img" class="user-img"></image>
				<view class="user-item">
					<view class="user-info ">
						<view class="name">欢迎你，{{info.name}}</view>
						<view class="status">作业人员</view>
					</view>
					<view class="phone">{{info.phone}}</view>
				</view>
			</view>
			<view class="search-block">
				<view class="iconfont icon-a-sousuo1"></view>
				<input placeholder="查询工单" v-model="keyword" class="search" />
			</view>
			<view class="menu-block">
				<view class="menu-left">
					<view class="menu-item" @click="navigate('/page_pack/fault/list?type=2')">
						<view class="menu-title">今日待办（5）</view>
						<view class="iconfont icon-a-youjiantou1"></view>
					</view>
					<view class="menu-item" @click="navigate('/page_pack/fault/list?type=3')">
						<view class="menu-title">已办（216）</view>
						<view class="iconfont icon-a-youjiantou1"></view>
					</view>
				</view>
				<view class="menu-right" @click="navigate('/page_pack/fault/list')">
					<view class="menu-name">作业现场反馈</view>
					<view class="small-btn FZHZGBJ">立即创建</view>
				</view>
			</view>
			<view class="title-block">
				<view class="title-item">
					<view class="line"></view>
					<view class="title">历史记录</view>
				</view>
				<view class="more" @click="navigate('/page_pack/fault/list')">更多</view>
			</view>
			<view class="new-block" v-for="item in list" :key="item.id" @click="goDetail(item.status)">
				<view class="new-title">{{item.subject}}</view>
				<view class="time-item">
					<view class="new-text">{{item.noticeTime}}</view>
					<view class="new-text" style="color: #ea0000;" v-if="item.status==2">待处理</view>
					<view class="new-text" style="color: #18aa00;" v-if="item.status==1">已维修</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {
					img: '',
					name: '朱瑞华',
					phone: '182****2023'
				},
				list: [{
						id: 1,
						subject: '世博花园12号楼4单元⻔⼝路⾯塌⽅',
						noticeTime: '2025-03-11 15:35',
						status: 2
					},
					{
						id: 2,
						subject: '世博花园12号楼4单元⻔⼝路⾯塌⽅',
						noticeTime: '2025-03-11 15:35',
						status: 1
					},
					{
						id: 3,
						subject: '世博花园12号楼4单元⻔⼝路⾯塌⽅                         ',
						noticeTime: '2025-03-11 15:35',
						status: 1
					},
					{
						id: 4,
						subject: '世博花园12号楼4单元⻔⼝路⾯塌⽅                         ',
						noticeTime: '2025-03-11 15:35',
						status: 1
					}
				],
			}
		},
		methods: {
			goDetail(status) {
				if (status == 2) {
					this.navigate('/page_pack/fault/receipt')
				} else {
					this.navigate('/page_pack/fault/detail')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.fault-pages {
		.bg-img {
			height: 650rpx;
			width: 100%;
			background-color: #fb4744;
			position: absolute;
		}

		.info-block {
			padding: 30rpx;
			position: relative;

			.user-block {
				display: flex;
				align-items: center;
				color: #fff;
				margin-bottom: 30rpx;

				.user-img {
					width: 110rpx;
					height: 110rpx;
					border-radius: 50%;
					background-color: #fff;
				}

				.user-item {
					margin-left: 30rpx;

					.user-info {
						display: flex;
						align-items: center;

						.name {
							font-size: 36rpx;
							font-weight: bold;
							margin-right: 20rpx;
						}

						.status {
							font-size: 24rpx;
							color: $theme-color;
							background-color: #fff;
							width: 130rpx;
							height: 40rpx;
							display: flex;
							align-items: center;
							justify-content: center;
							border-radius: 10rpx;
						}
					}
				}

				.phone {
					font-size: 26rpx;
					margin-top: 20rpx;
				}
			}

			.search-block {
				width: 100%;
				background-color: #fff;
				height: 90rpx;
				display: flex;
				align-items: center;
				border-radius: 20rpx;
				padding: 0 20rpx;
				margin-bottom: 30rpx;

				.iconfont {
					color: $theme-color;
					font-size: 34rpx;
					width: 50rpx;
				}

				.search {
					width: calc(100% - 50rpx);
				}
			}

			.menu-block {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.menu-left {
					width: calc(50% - 10rpx);
					height: 360rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.menu-item {
						height: calc(50% - 15rpx);
						background-color: #fff;
						box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
						border-radius: 20rpx;
						padding: 20rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;

						.menu-title {
							font-size: 34rpx;
							font-weight: bold;
							color: $theme-color;
						}

						.iconfont {
							font-size: 44rpx;
							color: #fc7e7c;
						}
					}
				}

				.menu-right {
					width: calc(50% - 10rpx);
					height: 360rpx;
					display: flex;
					flex-direction: column;
					justify-content: center;
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhouHousesLease/uniapp/mine/menu-img.png')no-repeat center;
					background-size: 100% 100%;
					border-radius: 20rpx;
					padding-left: 30rpx;

					.menu-name {
						color: #fff;
						font-weight: bold;
						font-size: 34rpx;
					}

					.small-btn {
						margin-top: 150rpx;
						width: 160rpx;
						background-color: #fff;
						color: $theme-color;
						font-size: 26rpx;
						box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.4);
					}
				}
			}

			.title-block {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.title-item {
					display: flex;
					align-items: center;
					margin: 30rpx 0;

					.line {
						width: 20rpx;
						height: 38rpx;
						background-color: $theme-color;
						border-radius: 40rpx;
						margin-right: 20rpx;
					}

					.title {
						font-size: 34rpx;
						font-weight: bold;
					}
				}

				.more {
					font-size: 28rpx;
					color: #767676;
				}
			}


			.new-block {
				background-color: #fff;
				margin-bottom: 30rpx;
				border-radius: 20rpx;
				padding: 30rpx;

				.new-title {
					font-size: 32rpx;
					margin-bottom: 20rpx;
				}

				.time-item {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.new-text {
						font-size: 28rpx;
						color: #767676;
					}
				}

			}
		}
	}
</style>